/**
 * com.dingjian.base.service.impl.BaseServiceImpl.java
 * 2012-6-26
 */
package com.dingjian.base.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.dingjian.base.CoreEntity;
import com.dingjian.base.dao.BaseDao;
import com.dingjian.base.dao.QueryExecutor;
import com.dingjian.base.service.BaseService;

/**
 * @author FengMy
 * @since 2012-6-26下午07:04:18
 */
public abstract class BaseServiceImpl<T extends CoreEntity> implements BaseService<T> {
	@Autowired
	protected QueryExecutor queryExecutor;
	@Override
	public void addEntity(T entity) {
		getDao().addEntity(entity);
	}

	@Override
	public void updateEntity(T entity) {
		getDao().updateEntity(entity);
	}

	@Override
	public void deleteEntity(T entity) {
		getDao().deleteEntity(entity);
	}

	@Override
	public void deleteById(String id) {
		getDao().deleteById(id);
	}

	@SuppressWarnings("unchecked")
	@Override
	public T getEntityById(String id) {
		return (T)getDao().getEntityById(id);
	}
	
	protected abstract BaseDao getDao();
	
	@Override
	public void deleteBatch(List<String> ids) {
		getDao().deleteBatch(ids);
	}
}
